<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="sign.css">
    <title>HW1:log in</title>
</head>
<body>
<script>
    function isvalid() {
        var d = localStorage.getItem(document.getElementById("ID").value);
        var data = JSON.parse(d);
        console.log(data.pw);
        if (!/[a-zA-Z0-9]{5,10}/.test(data.id)) {
            alert("間違いID");
            return false;
        }
        else if (document.getElementById("PW").value == data.pw) {
            alert("成功登陆，然而并没有什么卵用，另邮箱地址为："+data.email);
            return false;
        }
        else
        {
            alert("密码错误");
            return false;
        }
    }
</script>
<div id="all">
    <div class="login_header">
<a href="SighIn.html">登录</a>
<b class="point">·</b>
<a href="SignUp.html">注册</a>
    </div>
<form onsubmit="isvalid()">
    <input placeholder=" ID" type="text" id="ID" class="temp"><br>
    <input placeholder=" 密码" type="password" id="PW" class="temp"><br>
    <input type="submit" class="click" value="登录">
</form>
</div>
</body>
</html>